<?php


class UsersController extends Zend_Controller_Action{



public function  indexAction(){

    //заполняем титле
    $this->view->title = 'Список пользователей.';
    $this->view->headTitle($this->view->title,'PREPEND');


    $users = new Model_User();

    $this->view->users=$users->getAllUsers();



}

public function addAction(){

    $this->view->title= ' Добавление пользователя';
    $this->view->headTitle($this->view->title,'PREPEND');


    $form = new Form_User();



    if($this->getRequest()->isPost()){
        if($form->isValid($this->getRequest()->getPost())){


          $user = new Model_User();
          $user->fill($form->getValues());
          $user->date = date("Y-m-d H:i:s");
          $user->password = md5($user->password);
          $user->save();
          $this->_helper->redirector('index');

            
        }
     }

    $this->view->form = $form;

}

public function deleteAction(){


        echo $this->_getParam('id');

            $user = new Model_User($this->_getParam('id'));
            $user->delete();

         $this->_helper->redirector('index');


    





}

public function viewAction(){

$this->view->title = 'Промотр пользователя';
$this->view->headTitle($this->view->title,'PREPEND');

    
}


public function editAction(){


    $this->view->title = 'Редактирование пользователя';
    $this->view->headTitle($this->view->title,'PREPEND');


    $fomt = new Form_User();

}






    
}